﻿using System;
using Microsoft.Xna.Framework.Graphics;

namespace ThreeDContentPipeline
{
    public class TextureCubeWriter : ContentTypeWriter<TextureCubeContent>
    {
        public override void Write(TextureCubeContent value, ContentWriter writer)
        {
            writer.Write(value.Size);

            writer.Write(value.NegativeX.Bytes.Length);
            writer.Write(value.NegativeX.Bytes);
            writer.Write((int)CubeMapFace.NegativeX);

            writer.Write(value.NegativeY.Bytes.Length);
            writer.Write(value.NegativeY.Bytes);
            writer.Write((int)CubeMapFace.NegativeY);

            writer.Write(value.NegativeZ.Bytes.Length);
            writer.Write(value.NegativeZ.Bytes);
            writer.Write((int)CubeMapFace.NegativeZ);

            writer.Write(value.PositiveX.Bytes.Length);
            writer.Write(value.PositiveX.Bytes);
            writer.Write((int)CubeMapFace.PositiveX);

            writer.Write(value.PositiveY.Bytes.Length);
            writer.Write(value.PositiveY.Bytes);
            writer.Write((int)CubeMapFace.PositiveY);

            writer.Write(value.PositiveZ.Bytes.Length);
            writer.Write(value.PositiveZ.Bytes);
            writer.Write((int)CubeMapFace.PositiveZ);
        }

        public override string ContentReaderName()
        {
            return "ThreeDWorld.TextureCubeReader, ThreeDWorld";
        }
    }
}
